package code.c02;

import java.util.Scanner;

/**
 * @author thinkpad - 83start
 * @version v1.0
 * @create 2022/9/8 10:34
 * @package PACKAGE_NAME
 * @description 文件说明
 */

public class Factorial {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个整数");
        int n = scanner.nextInt();

        int fac = fac(n);
        System.out.println(n + "! = "+fac);
    }

    public static int fac(int n) {
        if (n == 1) {
            return 1;
        }
        return fac(n - 1) * n;
    }
}
